﻿import 'package:get/get.dart';
import 'package:azring/core/repository/default_api.dart';

class SecurityLogic extends GetxController {
  final phonenumber = ''.obs;
  final email = ''.obs;

  @override
  void onInit() {
    super.onInit();
    loadUserInfo();
  }

  /// 加载用户信息
  Future<void> loadUserInfo() async {
    try {
      final response = await DefaultApi().queryUserGet();
      if (response != null && response['code'] == 200) {
        final data = response['data'];
        phonenumber.value = data['phonenumber'] ?? '';
        email.value = data['email'] ?? '';
      }
    } catch (e) {
      print('加载用户信息失败: $e');
    }
  }
}
